<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  var arr = function (s) {
    let l = 0;
    let r = s.length - 1;
    while (l < r) {
      [s[l], s[r]] = [s[r], s[l]];
      l++;
      r--;
    }
    return s;
  };
  console.log(arr(s = ["h", "e", "l", "l", "o"]));
</script>

</html>